<template>
  <span class="cell-wrapper">
    <mydetail v-if="op=='Detail'" :col="col" :_field="col.field"></mydetail>
    <click_see v-else-if="op=='CLICK_SEE'" :col="col" :_field="col.field"></click_see>
    <myidshow v-else-if="op=='IDSHOW'" :col="col" :_field="col.field"></myidshow>
    <idsshow v-else-if="op=='IDSSHOW'" :col="col" :_field="col.field"></idsshow>
    <idshowapi v-else-if="op=='IDSHOWAPI'" :col="col" :_field="col.field"></idshowapi>
    <myjump v-else-if="op=='JUMP'" :col="col" :_field="col.field"></myjump>
    <popup_field v-else-if="op=='Popup'" :col="col" :_field="col.field"></popup_field>
    <myidshows v-else-if="op=='IDSHOWS'" :col="col" :_field="col.field"></myidshows>
    <myshowf v-else-if="op=='SHOWFIELD'" :col="col" :_field="col.field"></myshowf>
    <myopera v-else-if="col.btns" :col="col" :_field="col.field"></myopera>
    <span v-else v-html="col.rs" :style="colorConf" :_field="col.field">
    </span>
  </span>
</template>
<script>
  import mydetail from 'components/cell/detail'
  import myidshow from 'components/cell/idshow'
  import idsshow from 'components/cell/idsshow'
  import idshowapi from 'components/cell/idshowapi'
  import myjump from 'components/cell/jump'
  import popup_field from 'components/cell/popup_field'
  import myidshows from 'components/cell/idshows'
  import myshowf from  'components/cell/showField'
  import myopera from  'components/cell/opera'
  import click_see from  'components/cell/click_see'

  import tool from     'src/util/tool';
  import util from     '_util/index';
  import logic from '_logic';

  export default{
    data(){
      return {
        path: '',
        auths: null,
        cell_style: '',
        cell_type:'list'
      }
    },
    methods: {
        changeCellByFieldVal(param){
            logic.cell.changeCellByFieldVal_emit(this,param);
        },
      set_auths(){
//        if(['IDSHOWAPI'].contains(this.op)) {

//        }
      }
    },
    watch: {
    },
    computed: {
      op(){
        return this.col.op;
      },
        colorConf(){
//            let conf=this.colorConf_hled[this.col.field]
            let conf = this.colorConf_hled;
            if(!conf)
                return this.cell_style;
            let color=conf[this.col.val];
            return color == 'normal' ? this.cell_style : `color:rgba(${color});`;
        }
    },
    components: {
      mydetail,
      myidshow,
      idshowapi,
      myshowf,
      popup_field,
      click_see,
        myjump,
      myopera,
      idsshow,
      myidshows
    },
    props: ['col', 'ctl','test','colorConf_hled','cell_id'],
    mounted(){
//      this.$set(this.col,'_ctl',this.ctl)
        logic.cell.changeTrByFieldVal(this);
    },
    created(){

      this.path = this.$route.path
//      this.$set(this.col,'_ctl',this.ctl)
//      this.ctl = this.$route.query.ctl||'Hotel';
      let col = this.col;
      let ctl = this.ctl;
//      this.op = col.op;
      switch (ctl) {
        case 'Menu':

          break;

      }

//        this.set_auths();

        this.$set(this.col,'cell_id',this.cell_id)
        logic.cell.changeCellByFieldVal_on(this);
    }
  }
</script>
<style rel="stylesheet/less" scoped lang="less">

  @dir: "header/";
  .cell-wrapper{

  }
</style>
